/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package eventxmlparser;

import java.util.ArrayList;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import org.simpleframework.xml.Attribute;
import org.simpleframework.xml.ElementList;

/**
 *
 * @author krist_000
 */
public class Event {

    @Attribute
    private String id;
    
    @Attribute(required = false)
    private String action;
    
    @Attribute(required = false)
    private String message;
    
    @Attribute(required = false)
    private String duration;
    @Attribute(required = false)
    private String mediaSource;
    @Attribute(required = false)
    private String soundSource;
    
    @ElementList(required = false)
    private ArrayList<Transition> transitions;
    
    @ElementList(inline = true, required = false)
    private ArrayList<CloseByEvent> closeByEvents;
    
    @ElementList(inline = true, required = false)
    private ArrayList<RoomEvent> roomEvents;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getDuration() {
        return duration;
    }

    public void setDuration(String duration) {
        this.duration = duration;
    }

    public String getMediaSource() {
        return mediaSource;
    }

    public void setMediaSource(String mediaSource) {
        this.mediaSource = mediaSource;
    }

    public String getSoundSource() {
        return soundSource;
    }

    public void setSoundSource(String soundSource) {
        this.soundSource = soundSource;
    }

    @XmlElement(name = "transition")
    public ArrayList<Transition> getTransitions() {
        return transitions;
    }

    public void setTransitions(ArrayList<Transition> transitions) {
        this.transitions = transitions;
    }

    @XmlElement(name = "closeByEvent")
    public ArrayList<CloseByEvent> getCloseByEvents() {
        return closeByEvents;
    }

    public void setCloseByEvents(ArrayList<CloseByEvent> closeByEvents) {
        this.closeByEvents = closeByEvents;
    }

    @XmlElement(name = "roomEvent")
    public ArrayList<RoomEvent> getRoomEvents() {
        return roomEvents;
    }

    public void setRoomEvents(ArrayList<RoomEvent> roomEvents) {
        this.roomEvents = roomEvents;
    }

    @Override
    public String toString() {
        String str = "";
        str += "Event: " + getId();
        if (action != null) {
            str += " action " + action;
        }
        if (message != null) {
            str += " message " + message;
        }
        if (duration != null) {
            str += " duration " + duration;
        }
        if (mediaSource != null) {
            str += " mediaSource " + mediaSource;
        }
        if (soundSource != null) {
            str += " soundSource " + soundSource;
        }
        str += "\n";

        if (transitions != null) {
            for (Transition transition : transitions) {
                str += transition.toString();
            }
        }
        if (closeByEvents != null) {
            for (CloseByEvent closeBy : closeByEvents) {
                str += closeBy.toString();
            }
        }
        if (roomEvents != null) {
            for (RoomEvent roomEvent : roomEvents) {
                str += roomEvent.toString();
            }
        }
        str += "\n";
        return str;
    }

}
